//
//  BK_OD_LimitBuy_Cell.m
//  bestkeep
//
//  Created by TOPTEAM on 2017/3/3.
//  Copyright © 2017年 utouu. All rights reserved.
//

#import "BK_OD_LimitBuy_Cell.h"
#import "BK_OD_Color.h"
#import "BK_OD_Tool.h"
@implementation BK_OD_LimitBuy_Cell
{
    UILabel *_level;
    UILabel *_limitBuy;
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self initialize];
    }
    return self;
}

- (void)initialize
{
    _level = [[UILabel alloc] init];
    _level.font = UIFontCustom(12);
    _level.textAlignment = NSTextAlignmentCenter;
    [self.contentView addSubview:_level];
    
    _limitBuy = [[UILabel alloc] init];
    _limitBuy.font = UIFontCustom(12);
    _limitBuy.textAlignment = NSTextAlignmentCenter;
    [self.contentView addSubview:_limitBuy];
    
    [self makeConstraints];
}

- (void)makeConstraints
{
    [_level mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.bottom.top.mas_equalTo(self.contentView);
        make.right.mas_equalTo(self.contentView.mas_centerX);
    }];
    
    [_limitBuy mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.bottom.top.mas_equalTo(self.contentView);
        make.left.mas_equalTo(self.contentView.mas_centerX);
    }];
}

- (void)fillData:(id)data
{
    if (!data) {
        return;
    }
    
    BOOL currentLevelFlag = [data[@"currentLevelFlag"] boolValue];
    
    if (currentLevelFlag == YES) {
        _limitBuy.textColor = kOrderBKGreen;
        _level.textColor = kOrderBKGreen;
    }
    else{
        _limitBuy.textColor = [UIColor blackColor];
        _level.textColor = [UIColor blackColor];
    }
    _level.text = data[@"level"];
    _limitBuy.text = data[@"quotaMessage"];
}

+ (CGFloat)computeHeight:(id)data
{
    return 32;
}
@end

















